/*
package com.mingchuang.administrator.mingchuang.wifi;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;


public class WifiStart extends Activity {

	private static final int OPEN = 1;
	private static final int SERVEROPEN = 2;
	private static final int MODIFYOPEN = 3;
	private WifiManager mWifiManager;
	private WifiInfo mWifiInfo;
	private TextView usernametext = null;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.wifistart); // 设置当前屏幕

		mWifiManager = (WifiManager) this
				.getSystemService(Context.WIFI_SERVICE);

		mWifiInfo = mWifiManager.getConnectionInfo();
		String ip = intToIp(mWifiInfo.getIpAddress());

		usernametext = (TextView) findViewById(R.id.username);
		usernametext.setText(Build.MODEL);

		Toast.makeText(WifiStart.this, ip, Toast.LENGTH_SHORT).show();

	}

	*/
/************** 点击了“发送Wifi文件” ***************//*

	public void StartButton(View view) {

		if (mWifiManager.getWifiState() != WifiManager.WIFI_STATE_ENABLED) {
			showDialog(OPEN);// 调用onCreateDialog
		} else {
			Intent i = new Intent(WifiStart.this, WifiUserList.class);
			// Intent i = new Intent(WifiStart.this, choosecontactlocal.class);
			i.putExtra("username", usernametext.getText().toString());
			startActivity(i);
		}
	}

	*/
/************** 点击了“接收Wifi文件” ***************//*

	public void ReceiveButton(View view) {

		if (mWifiManager.getWifiState() != WifiManager.WIFI_STATE_ENABLED) {
			showDialog(SERVEROPEN);// 调用onCreateDialog
		} else {
			Intent intent = new Intent(WifiStart.this, WifiReceive.class);
			intent.putExtra("username", usernametext.getText().toString());
			startActivity(intent);
		}

	}

	*/
/************** 点击了“修改您的用户名” ***************//*

	public void ModifyButton(View view) {

		showDialog(MODIFYOPEN);// 调用onCreateDialog
	}

	*/
/************** 提示是否打开Wifi提示框 ***************//*

	protected Dialog onCreateDialog(int id) {
		switch (id) {
			case OPEN:
				return new AlertDialog.Builder(WifiStart.this).setTitle("温馨提示")
						.setMessage("您的WiFi处于关闭状态，是否打开？").setIcon(
								android.R.drawable.ic_dialog_info)
						.setPositiveButton("打开", new OnClickListener() {

							public void onClick(DialogInterface dialog, int which) {

								mWifiManager.setWifiEnabled(true);
								Toast.makeText(WifiStart.this, "已为您启动WiFi服务",
										Toast.LENGTH_SHORT).show();

								Intent i = new Intent(WifiStart.this,
										WifiUserList.class);
								startActivity(i);

							}
						}).setNegativeButton("取消", new OnClickListener() {

							public void onClick(DialogInterface dialog, int which) {

								Toast.makeText(WifiStart.this, "您的WiFi服务未启动",
										Toast.LENGTH_SHORT).show();

							}
						}).create();
			case SERVEROPEN:
				return new AlertDialog.Builder(WifiStart.this).setTitle("温馨提示")
						.setMessage("您的WiFi处于关闭状态，是否打开？").setIcon(
								android.R.drawable.ic_dialog_info)
						.setPositiveButton("打开", new OnClickListener() {

							public void onClick(DialogInterface dialog, int which) {

								mWifiManager.setWifiEnabled(true);
								Toast.makeText(WifiStart.this, "已为您启动WiFi服务",
										Toast.LENGTH_SHORT).show();

								Intent i = new Intent(WifiStart.this,
										WifiReceive.class);
								startActivity(i);

							}
						}).setNegativeButton("取消", new OnClickListener() {

							public void onClick(DialogInterface dialog, int which) {

								Toast.makeText(WifiStart.this, "您的WiFi服务未启动",
										Toast.LENGTH_SHORT).show();

							}
						}).create();
			case MODIFYOPEN:
				// 新建一个编辑框，默认显示设备名称+"_"
				final EditText deviceTypeEdit = new EditText(this);
				deviceTypeEdit.setText(Build.MODEL);
				// 把光标定位到最后一个字符后面
				deviceTypeEdit.setSelection(Build.MODEL.length());
				// 弹出对话框要求用户输入设备型号或标识
				new AlertDialog.Builder(this).setTitle("请输入设备型号或标识：").setView(
						deviceTypeEdit).setPositiveButton("确定",
						new DialogInterface.OnClickListener() {

							public void onClick(DialogInterface dialog, int which) {
								// 获取用户输入后的设备类型
								String devicetype = deviceTypeEdit.getText()
										.toString().trim();
								usernametext.setText(devicetype);

							}
						}).setNegativeButton("取消", null).show();
			default:
				return null;
		}
	}

	private String intToIp(int i) {

		return (i & 0xFF) + "." + ((i >> 8) & 0xFF) + "." + ((i >> 16) & 0xFF)
				+ "." + ((i >> 24) & 0xFF);

	}

	@Override
	public void onBackPressed() {
		// TODO Auto-generated method stub
		super.onBackPressed();
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();

	}

}
*/
